package br.com.imob.modelo;

import java.io.Serializable;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 *
 * @author Gilton Nascimento
 */
@Entity
@Table(name = "\"ACOMPANHAMENTO_JURIDICO\"", catalog = "imob", schema = "public")
@NamedQueries({
    @NamedQuery(name = "AcompanhamentoJuridico.findAll", query = "SELECT a FROM AcompanhamentoJuridico a"),
    @NamedQuery(name = "AcompanhamentoJuridico.findByAcjuridicoId", query = "SELECT a FROM AcompanhamentoJuridico a WHERE a.acjuridicoId = :acjuridicoId"),
    
    @NamedQuery(name = "AcompanhamentoJuridico.findByAcjDataAcompanhamento", query = "SELECT a FROM AcompanhamentoJuridico a WHERE a.acjDataAcompanhamento = :acjDataAcompanhamento"),
    @NamedQuery(name = "AcompanhamentoJuridico.findLikeByAcjDataAcompanhamento", query = "SELECT a FROM AcompanhamentoJuridico a WHERE a.acjDataAcompanhamento Like :acjDataAcompanhamento"),
    
    @NamedQuery(name = "AcompanhamentoJuridico.findByAcjDescricao", query = "SELECT a FROM AcompanhamentoJuridico a WHERE a.acjDescricao = :acjDescricao"),
    @NamedQuery(name = "AcompanhamentoJuridico.findLikeByAcjDescricao", query = "SELECT a FROM AcompanhamentoJuridico a WHERE a.acjDescricao Like :acjDescricao"),
    
    @NamedQuery(name = "AcompanhamentoJuridico.findByAcjReferenciaImovel", query = "SELECT a FROM AcompanhamentoJuridico a WHERE a.acjReferenciaImovel = :acjReferenciaImovel"),
    @NamedQuery(name = "AcompanhamentoJuridico.findLikeByAcjReferenciaImovel", query = "SELECT a FROM AcompanhamentoJuridico a WHERE a.acjReferenciaImovel Like :acjReferenciaImovel"),
    
    @NamedQuery(name = "AcompanhamentoJuridico.findByAcjStatus", query = "SELECT a FROM AcompanhamentoJuridico a WHERE a.acjStatus = :acjStatus"),
    @NamedQuery(name = "AcompanhamentoJuridico.findLikeByAcjStatus", query = "SELECT a FROM AcompanhamentoJuridico a WHERE a.acjStatus Like :acjStatus")
    })
    
public class AcompanhamentoJuridico extends ControlEntities implements Serializable {
    
	private static final long serialVersionUID = 1L;
    
    @Id
//  <editor-fold defaultstate="collapsed" desc="Geradores de Sequencias">
    @GeneratedValue(strategy = GenerationType.AUTO, generator = "SEQ_STORE")
    @SequenceGenerator(name = "SEQ_STORE", sequenceName = "next_acjuridico")// </editor-fold>
    @Basic(optional = false)
    @Column(name = "acjuridico_id", nullable = false)
    private Integer acjuridicoId;

    @Basic(optional = false)
    @Column(name = "acj_data_acompanhamento", nullable = false, length = 10)
    private String acjDataAcompanhamento;
    
    @Column(name = "acj_descricao", length = 150)
    private String acjDescricao;
    
    @Column(name = "acj_referencia_imovel", length = 50)
    private String acjReferenciaImovel;
    
    @Basic(optional = false)
    @Column(name = "acj_status", nullable = false, length = 45)
    private String acjStatus;
    
    @JoinColumn(name = "imovel_id", referencedColumnName = "imovel_id", nullable = false)
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Imovel imovel;
    
    @JoinColumn(name = "empresa_id", referencedColumnName = "empresa_id", nullable = false)
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Empresa empresa;

    public AcompanhamentoJuridico() { }
    public AcompanhamentoJuridico(Integer acjuridicoId) {
        this.acjuridicoId = acjuridicoId;
    }

    public AcompanhamentoJuridico(Integer acjuridicoId, String acjDataAcompanhamento, String acjStatus) {
        this.acjuridicoId = acjuridicoId;
        this.acjDataAcompanhamento = acjDataAcompanhamento;
        this.acjStatus = acjStatus;
    }
    public AcompanhamentoJuridico(Integer acjId, String acjData, String acjStatus, String desc) {
    	this(acjId, acjData, acjStatus);
    	acjDescricao = desc;
    }
    
    public AcompanhamentoJuridico(String tpStr, String arg) {
    	if("data".equals(tpStr))		acjDataAcompanhamento = arg;
    	if("descricao".equals(tpStr))	acjDescricao = arg;
    	if("referencia".equals(tpStr))	acjReferenciaImovel = arg;
    	if("status".equals(tpStr))		acjStatus = arg;
    }
    
    public AcompanhamentoJuridico(int id, String tpStr, String arg) {
    	this(tpStr, arg);
    	acjuridicoId = id;
    }
    
    public AcompanhamentoJuridico(String desc, String acjData, String status, String referencia) {
    	acjDataAcompanhamento = acjData;
    	acjStatus = status;
    	acjDescricao = desc;
    	acjReferenciaImovel = referencia;
    }

    
	//    Getts and Setts
    public Integer getAcjuridicoId() {
        return acjuridicoId;
    }

    public void setAcjuridicoId(Integer acjuridicoId) {
        this.acjuridicoId = acjuridicoId;
    }

    public String getAcjDataAcompanhamento() {
        return acjDataAcompanhamento;
    }

    public void setAcjDataAcompanhamento(String acjDataAcompanhamento) {
        this.acjDataAcompanhamento = acjDataAcompanhamento;
    }

    public String getAcjDescricao() {
        return acjDescricao;
    }

    public void setAcjDescricao(String acjDescricao) {
        this.acjDescricao = acjDescricao;
    }

    public String getAcjReferenciaImovel() {
        return acjReferenciaImovel;
    }

    public void setAcjReferenciaImovel(String acjReferenciaImovel) {
        this.acjReferenciaImovel = acjReferenciaImovel;
    }

    public String getAcjStatus() {
        return acjStatus;
    }

    public void setAcjStatus(String acjStatus) {
        this.acjStatus = acjStatus;
    }

    public Imovel getImovel() {
        return imovel;
    }

    public void setImovel(Imovel imovel) {
        this.imovel = imovel;
    }

    public Empresa getEmpresa() {
        return empresa;
    }

    public void setEmpresa(Empresa empresa) {
        this.empresa = empresa;
    }

    public Object[] getValues() {
    	Object[] values = {acjuridicoId, acjDataAcompanhamento, acjDescricao, acjReferenciaImovel, acjStatus};
    	return values;
    }
    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (acjuridicoId != null ? acjuridicoId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        if (!(object instanceof AcompanhamentoJuridico)) {
            return false;
        }
        AcompanhamentoJuridico other = (AcompanhamentoJuridico) object;
        if ((this.acjuridicoId == null && other.acjuridicoId != null) || (this.acjuridicoId != null && !this.acjuridicoId.equals(other.acjuridicoId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.com.imob.modelo.AcompanhamentoJuridico[acjuridicoId=" + acjuridicoId + "]";
    }

}
